<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Test Maximize</title>
  <script src="../../../lib/prototype.js" type="text/javascript"></script>
  <script src="../../../lib/effects.js" type="text/javascript"></script>
  <script src="../../../dist/window.js" type="text/javascript"></script>      
  <script src="../../assets/runner.js" type="text/javascript"></script>
  <link href="../../../themes/window/window.css" rel="stylesheet" type="text/css">
  <link href="../../../themes/window/mac_os_x.css" rel="stylesheet" type="text/css">
  <link href="../../../themes/shadow/mac_shadow.css" rel="stylesheet" type="text/css">
    
  <style type='text/css'>
  body { 
    background: url('../../assets/body_bg.png') repeat; 
  }           
  #info {
    position: fixed;
    top:0;
    left:0;
    padding:10px;
    z-index: 10000;
    background:#FFF;
    opacity:0.8;
  }   
  </style>
  <!--[if lt IE 7]> <link href="../../assets/ie6.css" rel="stylesheet" type="text/css"> <![endif]-->
  
</head>
<body class="noscroll">        
  <div id="info"></div>
  
<script type="text/javascript">
  var viewport;
                   
  function setScroll() {
    viewport.setScrollOffset({ top: 200, left: 0 });
    var offset = viewport.getScrollOffset();    
    if (offset.top != 200)
      alert('Error');
  }

  function maximizeWindow() {  
    w1.activate();
    w1.maximize();
    var offset = viewport.getScrollOffset();    
    if (offset.top != 0)
      alert('Error')
  } 

  function restoreWindow() {   
    w1.restore();  
  }                                                           

  function checkScroll() {
    var offset = viewport.getScrollOffset();   
    viewport.setScrollOffset({top:0, left:0});
   
    if (offset.top == 200)  
      scenarioSuccess();
    else
      scenarioFailure();
  }                                

  function changeAltitude() {
    w1.activate();
    w1.maximize();
  }

  
  function runTest() {
    viewport = UI.defaultWM.viewport;
    w1 = new UI.Window({theme: "mac_os_x", width: 200, top: 50, left: 50, shadow:true}).show();  
    w2 = new UI.Window({theme: "mac_os_x", width: 200, height: 1500, top: 150, left: 150, shadow:true}).show();  
    runScenario([ ["setScroll", 1], ["maximizeWindow", 1], ["restoreWindow", 2], ["checkScroll", 2] ]);    
  }  
  Event.observe(window, "load", runTest);
  
</script>

</body>
</html>
